package adv2;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class CSTest {

	public static void main(String[] args) {
		// Collections
		List<Double> l = new ArrayList<Double>();
		l.add(34.5);
		l.add(5.3);
		l.add(9.9);
		Collections.addAll(l, 1.5, 1.6, 1.7, 12.5, 9.6, 69.6);
		System.out.println(l);
		List<Integer> l2 = new ArrayList<Integer>();
		for (int i = 1; i <= 20; i++)
			l2.add((int) (Math.random() * 100));
		System.out.println(">>>>>>>>>>>");
		System.out.println(l2);
		int max = Collections.max(l2);
		System.out.println("最大的是" + max);
		Collections.sort(l2);
		System.out.println("排序后：" + l2);
		System.out.println(">>>>>>>>>>>>>>>>>>>>");
		List<Student> l3 = new ArrayList<Student>();
		l3.add(new Student("朱峰", "333", 21, "男"));
		l3.add(new Student("夏晓芳", "3223", 20, "女"));
		l3.add(new Student("方亚彬", "422", 23, "男"));
		l3.add(new Student("朱能", "3433", 23, "男"));
		l3.add(new Student("猪悟能", "39993", 21000, "男"));
		l3.add(new Student("沙悟净", "8833", 18000, "男"));
		l3.add(new Student("孙悟空", "45645", 36000, "鳐"));
		l3.add(new Student("Tom clusze", "6333", 52, "男"));
		l3.add(new Student("朱小峰", "33434", 20, "男"));
		System.out.println(">>>>>>>>>>>>>>>>>>");
		Student s = Collections.max(l3);
		System.out.println("最大的是" + s);
		s = Collections.min(l3);
		System.out.println("最xiao的是" + s);
		Collections.sort(l3);
		System.out.println("排序后：");
		for (Student st : l3)
			System.out.println(st);
	}
}
